<h2>View Subscriber</h2>
<hr/>
<p> The subscriber information, loan history and payment history are detailed on this page.
To modify subscriber information, select modify option.<br />
 To delete the subscriber, select delete.<br />
</p>
<center>

<!-- Subscriber information -->
<table>
<tr>
	<th align="right" width=30%>Subscriber Number:</th>
	<td><?php echo $subscriber->subscriber_id; ?></td>
</tr>
<tr>
	<th align="right">First Name:</th>
	<td><?php echo $subscriber->first_name; ?></td>
</tr>
<tr>
	<th align="right">Last Name:</th>
	<td><?php echo $subscriber->last_name; ?></td>
</tr>
<tr>
	<th align="right">Initials:</th>
	<td><?php echo $subscriber->initials; ?></td>
</tr>
<tr>
	<th align="right">Title:</th>
	<td><?php echo $subscriber->title; ?></td>
</tr>
<tr>
	<th align="right">Address 1:</th>
	<td><?php echo $subscriber->address1; ?></td>
</tr>
<tr>
	<th align="right">Address 2:</th>
	<td><?php echo $subscriber->address2; ?></td>
</tr>
<tr>
	<th align="right">Suburb:</th>
	<td><?php echo $subscriber->suburb; ?></td>
</tr>
<tr>
	<th align="right">Post Code:</th>
	<td><?php echo $subscriber->post_code; ?></td>
</tr>
<tr>
	<th align="right">Phone:</th>
	<td><?php echo $subscriber->phone; ?></td>
</tr>
<tr>
	<th align="right">Mobile Phone:</th>
	<td><?php echo $subscriber->mobile_phone; ?></td>
</tr>
<tr>
	<th align="right">Work Phone:</th>
	<td><?php echo $subscriber->work_phone; ?></td>
</tr>
<tr>
	<th align="right">Subscriber Status:</th>
	<td><?php echo $subscriber->subscriber_status; ?></td>
</tr>
<tr>
	<th align="right">Email:</th>
	<td><?php echo $subscriber->email; ?></td>
</tr>
<tr>
	<th align="right" class="tablehead">Actions</th>
	<td align="center">
	<?php echo anchor('staff/subscriber_management/modifySubscriber/' . $subscriber->subscriber_id, 'Modify'); ?>
	<?php //echo ' - ' . anchor('staff/subscriber_management/deleteSubscriber/' . $subscriber->subscriber_id . '/true', 'Delete', array('onclick'=>"return confirm('Are you sure you wish to remove this subscriber?');")); ?></td>
</tr>
</table>
<br />
<!-- Volumes on loan by subscriber -->
<h2>On Loan:</h2>
</center>
<p> To add a loan select add loan option:</p>
<center>
<table>
<tr>
	<th>Accession Number</th>
	<th>Title</th>
	<th>Loan Date</th>
	<th>Due Date</th>
	<th>Extension Date</th>
	<th class="tablehead">Actions</th>
</tr>
<?php
foreach ($volumes->result() as $volume)
{
	echo '<tr>';
	
	// Details
	echo '<td>' . anchor('staff/staff_catalogue/viewVolume/' . $volume->access_id, $volume->access_id) . '</td>';
	echo '<td>' . $volume->title . '</td>';
	echo '<td>' . $volume->loan_date . '</td>';
	echo '<td>' . $volume->due_date . '</td>';
	echo '<td>' . $volume->extension_date . '</td>';
	
	// Actions
	echo '<td>';
	echo anchor('staff/loan_management/extendLoan/' . $volume->access_id, 'Extend') . '/';
	echo anchor('staff/loan_management/returnLoan/' . $volume->access_id, 'Return');
	echo '</td>';
	echo '</tr>';
}
?>
<tr>
	<td></td><td></td><td></td><td></td><td></td><td><?php echo anchor('staff/loan_management/addLoan/' . $subscriber->subscriber_id, 'Add Loan'); ?></td>
</table>
<br />
<!-- Payment information for subscriber -->
<h3>Payment History</h3><br />
</center>
<p> To add a payment select add payment option:</p>
<center>
<table>
<tr>
	<th width=20%>Date Paid</th>
	<th width=20%>Receipt Number</th>
	<th width=20%>Amount</th>
	<th width=20%>Expiry Date</th>
	<th width=20% class="tablehead">Actions</th>
</tr>
<?php
foreach ($subscriber_paid->result() as $subscriber)
{
	echo '<tr>';
	
	// Details
	echo '<td>' . $subscriber->date_paid . '</td>';
	echo '<td>' . $subscriber->receipt_number . '</td>';
	echo '<td>' . $subscriber->amount . '</td>';
	echo '<td>' . $subscriber->expiry_date . '</td>';
	echo '<td/>';
	echo '</tr>';
}
?>
<tr>
	<td></td><td></td><td></td><td></td>
	<td><?php echo anchor('staff/subscriber_management/addPayment/' . $subscriber->subscriber_id, 'Add Payment'); ?></td>
</tr>
</table>

</center>
